package com.yingjia.yingjiauniversity.http.exception;

import io.reactivex.Observable;
import io.reactivex.functions.Function;

/**
 * <global response func, handle error etc..>
 */

public class ResponseFunc<T> implements Function<Throwable, Observable<T>> {
    @Override
    public Observable<T> apply(Throwable throwable) throws Exception {

        //TODO error 在ExceptionHandler中统一根据错误码处理异常
        return Observable.error(ExceptionHandler.handleException(throwable));
    }
}
